<template>
  <view>
    <navigator :url="`/pages/forum/personal?id=${type == 1 ? item.attUser.uid : item.user.uid}`"
               class="u-p-l-46 u-p-t-24 u-p-b-24 u-border-bottom u-flex" v-for="(item, index) in list" :key="index">
      <img :src="type == 1 ? item.attUser.avatar : item.user.avatar" alt="" class="avatar">
      <view class="u-flex-col">
        <view class="nickname">{{ type == 1 ? item.attUser.nickName : item.user.nickName}}</view>
        <view class="desc">{{ type == 1 ? item.attUser.attentionNum : item.user.attentionNum }}人关注</view>
      </view>
    </navigator>
  </view>
</template>

<script>
  import { request } from '../../util/api'
import {getCurrentFullPath} from "../../util/util";
  export default {
    onLoad(option) {
      uni.setNavigationBarTitle({
        title: option.type == 1 ? '关注' : '被关注'
      })
      this.userId = option.id
      this.type = option.type
    },

    data() {
      return {
        userId: '',
        type: '',
        list: []
      }
    },

    onShow() {
      this.getList()
    },

    methods: {
		// 转发功能
		onShareAppMessage(res) {
		  return {
		    path: getCurrentFullPath()
		  }
		},
      getList() {
        request({
          url: '/system/attention/list',
          data: this.type == 1 ? {
            UId: this.userId
          } : {
            attUId: this.userId
          }
        }).then(res => {
          this.list = res.rows
        })
      }
    }

  }
</script>

<style lang="scss" scoped>
  .avatar {
    width: 80rpx;
    height: 80rpx;
    border-radius: 100%;
    margin-right: 28rpx;
  }
  .nickname {
    color: rgba(4, 4, 4, 100);
    font-weight: bold;
    font-size: 28rpx;
  }
  .desc {
    font-size: 24rpx;
    color: rgba(16, 16, 16, .5);
  }
</style>
